package base

import (
	v1 "code.byted.org/bytertc/whiteboard_server/biz/api/pb/v1"
	"code.byted.org/bytertc/whiteboard_server/biz/config"
	"code.byted.org/bytertc/whiteboard_server/biz/dal"
	"google.golang.org/protobuf/proto"
)

type Info struct {
	AppId    string
	RoomId   string
	Operator string
}

func (i *Info) GetAppId() string {
	return i.AppId
}

func (i *Info) GetRoomId() string {
	return i.RoomId
}

func (i *Info) GetOperator() string {
	return i.Operator
}

type Command struct {
	Info
	Repo   dal.Repo
	Config config.DynamicConfig
}

type Result struct {
	Msg         proto.Message
	IsBroadcast bool
	CommandType v1.Command
	Error       error
}

func (r *Result) Command() v1.Command {
	return r.CommandType
}

func (r *Result) Broadcast() bool {
	return r.IsBroadcast
}

func (r *Result) Message() proto.Message {
	return r.Msg
}

func (r *Result) Err() error {
	return r.Error
}
